/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.dcc.ufmg.view;

import br.dcc.ufmg.controller.FilterController;

/**
 * 
 * @author tarcisio
 */
public class FilterJFrame extends javax.swing.JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1670511609423568945L;
	
	private FilterController controller;

	/**
	 * Creates new form FilterJFrame
	 */
	public FilterJFrame(FilterController controller) {
		initComponents();
		this.controller = controller;
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		fileChooser = new javax.swing.JFileChooser();
		panelXMLFilesSelection = new javax.swing.JPanel();
		jScrollPane1 = new javax.swing.JScrollPane();
		txtAreaFilesSelected = new javax.swing.JTextArea();
		btnXMLFilesSelection = new javax.swing.JButton();
		btnDoneSelection = new javax.swing.JButton();
		jLabel7 = new javax.swing.JLabel();
		txtSystemName = new javax.swing.JTextField();
		jPanel1 = new javax.swing.JPanel();
		jLabel1 = new javax.swing.JLabel();
		boxArtifactType = new javax.swing.JComboBox<String>();
		jScrollPane2 = new javax.swing.JScrollPane();
		txtAreaBooleanExpression = new javax.swing.JTextArea();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		jLabel5 = new javax.swing.JLabel();
		jLabel6 = new javax.swing.JLabel();
		txtFieldOrder = new javax.swing.JTextField();
		btnFilterExecution = new javax.swing.JButton();
		btnReset = new javax.swing.JButton();

		fileChooser.setMultiSelectionEnabled(true);

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

		panelXMLFilesSelection.setBorder(javax.swing.BorderFactory
				.createTitledBorder("XML Metric Files Selection"));
		panelXMLFilesSelection.setToolTipText("");

		jScrollPane1.setBorder(new javax.swing.border.SoftBevelBorder(
				javax.swing.border.BevelBorder.RAISED));

		txtAreaFilesSelected.setEditable(false);
		txtAreaFilesSelected.setColumns(20);
		txtAreaFilesSelected.setRows(5);
		jScrollPane1.setViewportView(txtAreaFilesSelected);

		btnXMLFilesSelection.setText("Select XML Files");
		btnXMLFilesSelection
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						controller.btnXMLFilesSelectionActionPerformed(evt);
					}
				});

		btnDoneSelection.setText("Done");
		btnDoneSelection.setEnabled(false);
		btnDoneSelection.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				controller.btnDoneSelectionActionPerformed(evt);
			}
		});

		jLabel7.setText("System Name:");

		javax.swing.GroupLayout panelXMLFilesSelectionLayout = new javax.swing.GroupLayout(
				panelXMLFilesSelection);
		panelXMLFilesSelection.setLayout(panelXMLFilesSelectionLayout);
		panelXMLFilesSelectionLayout
				.setHorizontalGroup(panelXMLFilesSelectionLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								panelXMLFilesSelectionLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												panelXMLFilesSelectionLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																panelXMLFilesSelectionLayout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel7)
																		.addGap(18,
																				18,
																				18)
																		.addComponent(
																				txtSystemName))
														.addComponent(
																jScrollPane1))
										.addGap(18, 18, 18)
										.addGroup(
												panelXMLFilesSelectionLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																btnXMLFilesSelection)
														.addComponent(
																btnDoneSelection,
																javax.swing.GroupLayout.Alignment.TRAILING))
										.addContainerGap()));
		panelXMLFilesSelectionLayout
				.setVerticalGroup(panelXMLFilesSelectionLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								panelXMLFilesSelectionLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												panelXMLFilesSelectionLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel7)
														.addComponent(
																txtSystemName,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addGap(18, 18, 18)
										.addGroup(
												panelXMLFilesSelectionLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																panelXMLFilesSelectionLayout
																		.createSequentialGroup()
																		.addComponent(
																				btnXMLFilesSelection)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				37,
																				Short.MAX_VALUE)
																		.addComponent(
																				btnDoneSelection))
														.addComponent(
																jScrollPane1,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																0,
																Short.MAX_VALUE))
										.addContainerGap()));

		jPanel1.setBorder(javax.swing.BorderFactory
				.createTitledBorder(javax.swing.BorderFactory
						.createTitledBorder("Filter")));

		jLabel1.setText("Type of Artifact Filtered:");

		boxArtifactType.setModel(new javax.swing.DefaultComboBoxModel<String>(
				new String[] { "Method", "Class", "Package" }));
		boxArtifactType.setEnabled(false);

		txtAreaBooleanExpression.setColumns(20);
		txtAreaBooleanExpression.setRows(5);
		txtAreaBooleanExpression.setEnabled(false);
		jScrollPane2.setViewportView(txtAreaBooleanExpression);

		jLabel2.setText("Filter Expression:");

		jLabel3.setText("* Use AND/OR operands to combine your own filtering mechanism. ");

		jLabel4.setText("* Use UNCOMMON[id], CASUAL[id] or COMMON[id] to filter the");

		jLabel5.setText("artifacts with the three ranges of the specified thresholds.");

		jLabel6.setText("Order artifacts with Metric:");

		txtFieldOrder.setEnabled(false);

		javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
				jPanel1);
		jPanel1.setLayout(jPanel1Layout);
		jPanel1Layout
				.setHorizontalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jScrollPane2)
														.addGroup(
																jPanel1Layout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel1)
																		.addGap(18,
																				18,
																				18)
																		.addComponent(
																				boxArtifactType,
																				0,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE))
														.addGroup(
																jPanel1Layout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel6)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				txtFieldOrder))
														.addGroup(
																jPanel1Layout
																		.createSequentialGroup()
																		.addGroup(
																				jPanel1Layout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jLabel2)
																						.addComponent(
																								jLabel3)
																						.addComponent(
																								jLabel4)
																						.addComponent(
																								jLabel5))
																		.addGap(0,
																				0,
																				Short.MAX_VALUE)))
										.addContainerGap()));
		jPanel1Layout
				.setVerticalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel1)
														.addComponent(
																boxArtifactType,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jLabel2)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(jLabel3)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(jLabel4)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(jLabel5)
										.addGap(18, 18, 18)
										.addComponent(
												jScrollPane2,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addGap(18, 18, 18)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel6)
														.addComponent(
																txtFieldOrder,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap(
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));

		btnFilterExecution.setText("Filter Execution");
		btnFilterExecution.setEnabled(false);
		btnFilterExecution
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						controller.btnFilterExecutionActionPerformed(evt);
					}
				});

		btnReset.setText("Reset Loaded System");
		btnReset.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				controller.btnResetActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addComponent(
														jPanel1,
														javax.swing.GroupLayout.Alignment.TRAILING,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE)
												.addComponent(
														panelXMLFilesSelection,
														javax.swing.GroupLayout.Alignment.TRAILING,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE)
												.addGroup(
														javax.swing.GroupLayout.Alignment.TRAILING,
														layout.createSequentialGroup()
																.addComponent(
																		btnReset)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		Short.MAX_VALUE)
																.addComponent(
																		btnFilterExecution)))
								.addContainerGap()));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addComponent(panelXMLFilesSelection,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										Short.MAX_VALUE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
								.addComponent(jPanel1,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(
														btnFilterExecution)
												.addComponent(btnReset))
								.addContainerGap()));

		panelXMLFilesSelection.getAccessibleContext().setAccessibleName(
				"XML Files Selection");

		pack();
	}// </editor-fold>//GEN-END:initComponents

	/**
	 * @param args
	 *            the command line arguments
	 */

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JComboBox<String> boxArtifactType;
	private javax.swing.JButton btnDoneSelection;
	private javax.swing.JButton btnFilterExecution;
	private javax.swing.JButton btnReset;
	private javax.swing.JButton btnXMLFilesSelection;
	private javax.swing.JFileChooser fileChooser;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel7;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JScrollPane jScrollPane2;
	private javax.swing.JPanel panelXMLFilesSelection;
	private javax.swing.JTextArea txtAreaBooleanExpression;
	private javax.swing.JTextArea txtAreaFilesSelected;
	private javax.swing.JTextField txtFieldOrder;
	private javax.swing.JTextField txtSystemName;
	// End of variables declaration//GEN-END:variables

	public javax.swing.JComboBox<String> getBoxArtifactType() {
		return boxArtifactType;
	}

	public void setBoxArtifactType(javax.swing.JComboBox<String> boxArtifactType) {
		this.boxArtifactType = boxArtifactType;
	}

	public javax.swing.JButton getBtnDoneSelection() {
		return btnDoneSelection;
	}

	public void setBtnDoneSelection(javax.swing.JButton btnDoneSelection) {
		this.btnDoneSelection = btnDoneSelection;
	}

	public javax.swing.JButton getBtnFilterExecution() {
		return btnFilterExecution;
	}

	public void setBtnFilterExecution(javax.swing.JButton btnFilterExecution) {
		this.btnFilterExecution = btnFilterExecution;
	}

	public javax.swing.JButton getBtnReset() {
		return btnReset;
	}

	public void setBtnReset(javax.swing.JButton btnReset) {
		this.btnReset = btnReset;
	}

	public javax.swing.JButton getBtnXMLFilesSelection() {
		return btnXMLFilesSelection;
	}

	public void setBtnXMLFilesSelection(javax.swing.JButton btnXMLFilesSelection) {
		this.btnXMLFilesSelection = btnXMLFilesSelection;
	}

	public javax.swing.JFileChooser getFileChooser() {
		return fileChooser;
	}

	public void setFileChooser(javax.swing.JFileChooser fileChooser) {
		this.fileChooser = fileChooser;
	}

	public javax.swing.JLabel getjLabel1() {
		return jLabel1;
	}

	public void setjLabel1(javax.swing.JLabel jLabel1) {
		this.jLabel1 = jLabel1;
	}

	public javax.swing.JLabel getjLabel2() {
		return jLabel2;
	}

	public void setjLabel2(javax.swing.JLabel jLabel2) {
		this.jLabel2 = jLabel2;
	}

	public javax.swing.JLabel getjLabel3() {
		return jLabel3;
	}

	public void setjLabel3(javax.swing.JLabel jLabel3) {
		this.jLabel3 = jLabel3;
	}

	public javax.swing.JLabel getjLabel4() {
		return jLabel4;
	}

	public void setjLabel4(javax.swing.JLabel jLabel4) {
		this.jLabel4 = jLabel4;
	}

	public javax.swing.JLabel getjLabel5() {
		return jLabel5;
	}

	public void setjLabel5(javax.swing.JLabel jLabel5) {
		this.jLabel5 = jLabel5;
	}

	public javax.swing.JLabel getjLabel6() {
		return jLabel6;
	}

	public void setjLabel6(javax.swing.JLabel jLabel6) {
		this.jLabel6 = jLabel6;
	}

	public javax.swing.JLabel getjLabel7() {
		return jLabel7;
	}

	public void setjLabel7(javax.swing.JLabel jLabel7) {
		this.jLabel7 = jLabel7;
	}

	public javax.swing.JPanel getjPanel1() {
		return jPanel1;
	}

	public void setjPanel1(javax.swing.JPanel jPanel1) {
		this.jPanel1 = jPanel1;
	}

	public javax.swing.JScrollPane getjScrollPane1() {
		return jScrollPane1;
	}

	public void setjScrollPane1(javax.swing.JScrollPane jScrollPane1) {
		this.jScrollPane1 = jScrollPane1;
	}

	public javax.swing.JScrollPane getjScrollPane2() {
		return jScrollPane2;
	}

	public void setjScrollPane2(javax.swing.JScrollPane jScrollPane2) {
		this.jScrollPane2 = jScrollPane2;
	}

	public javax.swing.JPanel getPanelXMLFilesSelection() {
		return panelXMLFilesSelection;
	}

	public void setPanelXMLFilesSelection(javax.swing.JPanel panelXMLFilesSelection) {
		this.panelXMLFilesSelection = panelXMLFilesSelection;
	}

	public javax.swing.JTextArea getTxtAreaBooleanExpression() {
		return txtAreaBooleanExpression;
	}

	public void setTxtAreaBooleanExpression(
			javax.swing.JTextArea txtAreaBooleanExpression) {
		this.txtAreaBooleanExpression = txtAreaBooleanExpression;
	}

	public javax.swing.JTextArea getTxtAreaFilesSelected() {
		return txtAreaFilesSelected;
	}

	public void setTxtAreaFilesSelected(javax.swing.JTextArea txtAreaFilesSelected) {
		this.txtAreaFilesSelected = txtAreaFilesSelected;
	}

	public javax.swing.JTextField getTxtFieldOrder() {
		return txtFieldOrder;
	}

	public void setTxtFieldOrder(javax.swing.JTextField txtFieldOrder) {
		this.txtFieldOrder = txtFieldOrder;
	}

	public javax.swing.JTextField getTxtSystemName() {
		return txtSystemName;
	}

	public void setTxtSystemName(javax.swing.JTextField txtSystemName) {
		this.txtSystemName = txtSystemName;
	}
	
}
